(function($){
    bela.prep["applyMixin"] = function(key,value,jsonParent,jqueryParent,belaJson){
        if(bela.elementRegex.test(key) && /.*%.*/i.test(key)){
            var mixins = key.match(/%[^\.%#]+/g);
            $.each(mixins,function(i,mixin){
                var tomix = bela.mixins[mixin.slice(1)];
                if(tomix){
                    $.each(tomix,function(k,v){
                        var empty = {};
                        $.extend(true, empty, v, value[k]);
                        value[k] = empty;
                    });
                }
            });
        }
    };
    bela.mixins = {};
    bela.registerMixins = function(mixins){
        $.each(mixins, function(k,v){
            bela.mixins[k] = v;
        }); 
    };
}(jQuery));
